<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="https://www.thymeleaf.org"
    xmlns:sec="https://www.thymeleaf.org/thymeleaf-extras-springsecurity4">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>秘籍首页</title>
</head>

<body>
    <h1 align="center">欢迎光临武林秘籍管理系统</h1>
    <div sec:authorize="!isAuthenticated()">
        <h2 align="center">游客您好，如果想查看武林秘籍 <a th:href="@{/login}">请登录</a></h2>
    </div>
    <div sec:authorize="isAuthenticated()">
        <h2><span sec:authentication="name"></span>，您好，您的角色有：
            <span sec:authentication="principal.authorities"></span>
        </h2>
        <form th:action="@{/logout}" method="post">
            <input type="submit" th:value="注销" />
        </form>
    </div>
    <hr>
    <div>
        <h3>入门武功秘籍</h3>
        <ul>
            <li><a th:href="@{/level/1}">马步</a> </li>
            <li><a th:href="@{/level/2}">体能</a> </li>
            <li><a th:href="@{/level/3}">吐息</a> </li>
        </ul>
    </div>
    <div sec:authorize="hasRole('V1')">
        <h3>普通武功秘籍</h3>
        <ul>
            <li><a th:href="@{/level1/1}">罗汉拳</a></li>
            <li><a th:href="@{/level1/2}">武当长拳</a></li>
            <li><a th:href="@{/level1/3}">全真剑法</a></li>
        </ul>
    </div>

    <div sec:authorize="hasRole('V2')">
        <h3>高级武功秘籍</h3>
        <ul>
            <li><a th:href="@{/level2/1}">太极拳</a></li>
            <li><a th:href="@{/level2/2}">七伤拳</a></li>
            <li><a th:href="@{/level2/3}">梯云纵</a></li>
        </ul>
    </div>

    <div sec:authorize="hasRole('V3')">
        <h3>绝世武功秘籍</h3>
        <ul>
            <li><a th:href="@{/level3/1}">葵花宝典</a></li>
            <li><a th:href="@{/level3/2}">龟派气功</a></li>
            <li><a th:href="@{/level3/3}">独孤九剑</a></li>
        </ul>
    </div>

</body>

</html>